package com.zhangdi.dwperms.entity;

import com.zhangdi.dwdata.entity.BaseEntity;

import javax.persistence.*;
import java.util.Set;

@Entity
@Table(name = "menu")
public class Menu extends BaseEntity {
    private String name;
    private String url;
    private String perms;
    private int lft;
    private int rgt;
    @ManyToOne
    @JoinColumn(name = "pid")
    private Menu parent;
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "parent")
    private Set<Menu> children;
    @ManyToMany(fetch = FetchType.LAZY, mappedBy = "menus")
    private Set<Role> roles;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPerms() {
        return perms;
    }

    public void setPerms(String perms) {
        this.perms = perms;
    }

    public int getLft() {
        return lft;
    }

    public void setLft(int lft) {
        this.lft = lft;
    }

    public int getRgt() {
        return rgt;
    }

    public void setRgt(int rgt) {
        this.rgt = rgt;
    }

    public Menu getParent() {
        return parent;
    }

    public void setParent(Menu parent) {
        this.parent = parent;
    }

    public Set<Menu> getChildren() {
        return children;
    }

    public void setChildren(Set<Menu> children) {
        this.children = children;
    }

    public Set<Role> getRoles() {
        return roles;
    }

    public void setRoles(Set<Role> roles) {
        this.roles = roles;
    }
}
